/*
 * OpenVMP, 2022
 *
 * Author: Roman Kuzmenko
 * Created: 2022-09-24
 *
 * Licensed under Apache License, Version 2.0.
 */

#ifndef OPENVMP_MODBUS_PROTOCOL_H
#define OPENVMP_MODBUS_PROTOCOL_H

#define MODBUS_FC_READ_COIL ((uint8_t)0x01)
#define MODBUS_FC_WRITE_COIL ((uint8_t)0x05)
#define MODBUS_FC_WRITE_COIL_CONTINUOUS ((uint8_t)0x0F)
#define MODBUS_FC_READ_HOLDING_REGISTERS ((uint8_t)0x03)
#define MODBUS_FC_PRESET_SINGLE_REGISTER ((uint8_t)0x06)
#define MODBUS_FC_PRESET_MULTIPLE_REGISTERS ((uint8_t)0x10)
#define MODBUS_FC_GET_COM_EVENT_LOG ((uint8_t)0x0C)
#define MODBUS_FC_READ_DEVICE_ID ((uint8_t)0x2B)

#define MODBUS_EXC_ILLEGAL_FUNCTION 0x01
#define MODBUS_EXC_ILLEGAL_DATA_ADDRESS 0x02
#define MODBUS_EXC_ILLEGAL_DATA_VALUE 0x03
#define MODBUS_EXC_SERVER_DEVICE_FAILURE 0x04
#define MODBUS_EXC_ACKNOWLEDGE 0x05
#define MODBUS_EXC_SERVER_DEVICE_BUSY 0x06
#define MODBUS_EXC_NEGATIVE_ACKNOWLEDGE 0x07
#define MODBUS_EXC_MEMORY_PARITY_ERROR 0x08
#define MODBUS_EXC_GATEWAY_PATH_UNAVAILABLE 0x0A
#define MODBUS_EXC_GATEWAY_TARGET_DEVICE_FAILED_TO_RESPOND 0x0B

namespace ros2_modbus {}

#endif  // OPENVMP_MODBUS_PROTOCOL_H
